home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 75 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: news.rmii.com!usenet
  2. From: jcoffin@rmii.com (Jerry Coffin)
  3. Newsgroups: comp.std.c
  4. Subject: Re: int's and zero
  5. Date: Wed, 10 Jan 1996 20:16:06 GMT
  6. Organization: TAEUS
  7. Message-ID: <4d12qv$fir@natasha.rmii.com>
  8. References: <4cth4e$4q@odin.funcom.no> <4cub1a$jbl@alterdial.UU.NET>
  9. NNTP-Posting-Host: slip8167.rmii.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. rex@aussie.com wrote:
  13.  
  14. >There was considerable debate about whether or not integers could be stored 
  15. >as BCD, Grey code, or some such, but in the end, we decided that they had to 
  16. >be stored as binary numbers. And, of course, 2's comp, 1's comp, and signed 
  17. >magnitude all use all-bits-zero for zero. The only thing that could cause a 
  18. >problem is for machines/compilers with signed zeros; I think that negative 
  19. >zero might have some other bit pattern.
  20.  
  21. Yes -- in one's complement, `-0' is represented with all bits set to 1.
  22. With one's complement, the usual method of testing for 0 is something
  23. like: `if (x+0 == 0)' since the addition of 0 normally produces a
  24. positive 0.  If memory serves some of the more widely used one's
  25. complement machines (e.g. CDC 6000/7000/Cyber's) had a pseudo-register
  26. set to a constant value of 0 that came in handy for this.
  27. (Unfortunately, they also used 6 bit characters, so a conforming
  28. implementation of C would have been quite difficult anyway...)
  29.     Later,
  30.     Jerry.
  31.  
  32. /* I can barely express my own opinions; I certainly can't
  33.  * express anybody else's.
  34.  *
  35.  * The universe is a figment of its own imagination.
  36.  */
  37.  
  38.